var user = {
  name: "sdfgsdfg",
  age: 12,
  like: "dfgsdf"
}
var {name, age, like} = user;
console.log(age);
function getGongLing(entryDate) {
  var myDate = new Date();
  var fullYear = myDate.getFullYear();
  var month = myDate.getMonth() + 1;
  var date = myDate.getDate();
  var gongzuosj = entryDate.replace(/-/g, "");//把入职时间转换为19990909的格式
  //截取入职的年月日
  var gongzuoyear = gongzuosj.substring(0, 4);
  var gongzuomonth = gongzuosj.substring(4, 6);
  var gongzuoday = gongzuosj.substring(6, 9);
  if (parseInt(gongzuoday) != 1) {
    if (parseInt(gongzuomonth) == 12) {
      gongzuomonth = '01';
      gongzuoyear =parseInt(gongzuoyear)+ 1;
    } else {
      gongzuomonth = parseInt(gongzuomonth)+ 1;
    }
  }
  console.log(gongzuoyear + "-" + gongzuomonth + "-" + gongzuoday);
  //计算工龄
  var jobAge = fullYear - gongzuoyear - 1;
  if (gongzuomonth < month || gongzuomonth == month && gongzuoday <= date) {
    jobAge++;
  }
  return jobAge;
}
var resl = getGongLing("2020-06-29");
console.log(resl);













